<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI文书委托案件库-历史案件库</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', sans-serif;
            background: #f5f5f5;
            color: #333;
            min-height: 100vh;
        }

        /* 主内容区 */
        .main-content {
            max-width: 1200px;
            margin: 0 auto;
            padding: 20px;
            overflow-y: auto;
        }

        .header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 10px;
            border-bottom: 1px solid #ddd;
            position: relative;
        }

        .page-title-container {
            display: flex;
            align-items: center;
        }

        .back-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            background: #3498db;
            color: white;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            margin-right: 15px;
            cursor: pointer;
            transition: all 0.3s;
            text-decoration: none;
            font-size: 18px;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .back-btn:hover {
            background: #2980b9;
            transform: translateX(-3px);
        }

        .page-title {
            font-size: 24px;
            font-weight: bold;
        }

        .user-info {
            display: flex;
            align-items: center;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            margin-right: 10px;
            background: #3498db;
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
        }

        .user-name {
            font-weight: bold;
        }

        /* 搜索框 */
        .search-container {
            background: white;
            padding: 20px;
            border-radius: 5px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            margin-bottom: 20px;
        }

        .search-title {
            font-size: 18px;
            font-weight: bold;
            margin-bottom: 15px;
        }

        .search-form {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 15px;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
            font-size: 14px;
        }

        .form-input, .form-select {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }

        .form-input:focus, .form-select:focus {
            border-color: #3498db;
            outline: none;
            box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
        }

        .date-range {
            display: flex;
            align-items: center;
        }

        .date-range input {
            flex: 1;
        }

        .date-separator {
            margin: 0 10px;
            color: #7f8c8d;
        }

        .search-actions {
            grid-column: 1 / -1;
            display: flex;
            justify-content: center;
            margin-top: 10px;
        }

        .search-btn {
            background: #3498db;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s;
            margin-right: 10px;
        }

        .search-btn:hover {
            background: #2980b9;
        }

        .reset-btn {
            background: #95a5a6;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .reset-btn:hover {
            background: #7f8c8d;
        }

        /* 案件列表 */
        .case-list {
            background: white;
            border-radius: 5px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            overflow: hidden;
        }

        .case-list-header {
            background: #f8f9fa;
            padding: 15px 20px;
            border-bottom: 1px solid #ddd;
            font-weight: bold;
            display: flex;
            align-items: center;
        }

        .case-list-title {
            flex: 1;
            font-size: 18px;
        }

        .case-filter {
            display: flex;
            align-items: center;
        }

        .filter-label {
            margin-right: 10px;
            font-size: 14px;
        }

        .filter-select {
            padding: 5px 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
        }

        .case-table {
            width: 100%;
            border-collapse: collapse;
        }

        .case-table th,
        .case-table td {
            padding: 15px 20px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }

        .case-table th {
            font-weight: bold;
            background: #f8f9fa;
        }

        .case-table tr:hover {
            background: #f5f5f5;
        }

        /* 办案时效列样式 */
        .case-table th:nth-child(7),
        .case-table td:nth-child(7) {
            text-align: center;
            width: 120px;
        }

        .efficiency-hours {
            color: #e74c3c;
            font-weight: bold;
        }

        .efficiency-good {
            color: #27ae60;
            font-weight: bold;
        }

        .efficiency-normal {
            color: #f39c12;
            font-weight: bold;
        }

        .efficiency-slow {
            color: #e74c3c;
            font-weight: bold;
        }

        /* 调整列宽 */
        .case-table th:nth-child(1), .case-table td:nth-child(1) { width: 60px; text-align: center; }
        .case-table th:nth-child(2), .case-table td:nth-child(2) { width: 140px; }
        .case-table th:nth-child(3), .case-table td:nth-child(3) { width: 100px; }
        .case-table th:nth-child(4), .case-table td:nth-child(4) { width: 130px; }
        .case-table th:nth-child(5), .case-table td:nth-child(5) { width: 140px; font-size: 13px; }
        .case-table th:nth-child(6), .case-table td:nth-child(6) { width: 140px; font-size: 13px; }
        .case-table th:nth-child(7), .case-table td:nth-child(7) { width: 120px; text-align: center; }
        .case-table th:nth-child(8), .case-table td:nth-child(8) { width: 280px; }

        .case-action {
            color: #3498db;
            margin-right: 10px;
            cursor: pointer;
        }

        .case-action:hover {
            text-decoration: underline;
        }

        /* 分页 */
        .pagination {
            display: flex;
            justify-content: center;
            margin-top: 20px;
        }

        .page-item {
            width: 35px;
            height: 35px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid #ddd;
            margin: 0 5px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .page-item:hover {
            border-color: #3498db;
            color: #3498db;
        }

        .page-item.active {
            background: #3498db;
            color: white;
            border-color: #3498db;
        }

        /* 操作按钮 */
        .btn {
            display: inline-block;
            padding: 6px 12px;
            margin-right: 5px;
            border-radius: 4px;
            font-size: 14px;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
        }

        .btn-primary {
            background: #3498db;
            color: white;
            border: none;
        }

        .btn-primary:hover {
            background: #2980b9;
        }

        .btn-success {
            background: #2ecc71;
            color: white;
            border: none;
        }

        .btn-success:hover {
            background: #27ae60;
        }

        /* 办案时效样式 */
        .efficiency-good {
            color: #27ae60;
            font-weight: bold;
        }

        .efficiency-normal {
            color: #f39c12;
            font-weight: bold;
        }

        .efficiency-slow {
            color: #e74c3c;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <!-- 主内容区 -->
    <div class="main-content">
        <div class="header">
            <div class="page-title-container">
                <a href="AI文书首页.html" class="back-btn">←</a>
                <div class="page-title">历史案件库</div>
            </div>
            <div class="user-info">
                <div class="user-avatar">A</div>
                <div class="user-name">管理员</div>
            </div>
        </div>

        <!-- 搜索框 -->
        <div class="search-container">
            <div class="search-title">案件搜索</div>
            <form class="search-form">
                <div class="form-group">
                    <label class="form-label">案件类型</label>
                    <select class="form-select">
                        <option value="">全部</option>
                        <option value="clinical">法医临床鉴定</option>
                        <option value="pathology">法医病理鉴定</option>
                        <option value="toxicology">法医毒物鉴定</option>
                        <option value="psychiatric">法医精神病鉴定</option>
                        <option value="evidence">法医物证鉴定</option>
                        <option value="medical">医疗损害鉴定</option>
                    </select>
                </div>
                <div class="form-group">
                    <label class="form-label">委托人信息</label>
                    <input type="text" class="form-input" placeholder="姓名/手机号/身份证号">
                </div>
                <div class="form-group">
                    <label class="form-label">案件编号</label>
                    <input type="text" class="form-input" placeholder="请输入案件编号">
                </div>
                <div class="form-group">
                    <label class="form-label">委托时间</label>
                    <div class="date-range">
                        <input type="date" class="form-input">
                        <span class="date-separator">至</span>
                        <input type="date" class="form-input">
                    </div>
                </div>
                <div class="form-group">
                    <label class="form-label">关键词</label>
                    <input type="text" class="form-input" placeholder="请输入关键词">
                </div>
                <div class="search-actions">
                    <button type="submit" class="search-btn">搜索</button>
                    <button type="reset" class="reset-btn">重置</button>
                </div>
            </form>
        </div>

        <!-- 案件列表 -->
        <div class="case-list">
            <div class="case-list-header">
                <div class="case-list-title">历史案件列表</div>
                <div class="case-filter">
                    <span class="filter-label">委托类型:</span>
                    <select class="filter-select">
                        <option value="all">全部</option>
                        <option value="clinical">法医临床鉴定</option>
                        <option value="pathology">法医病理鉴定</option>
                        <option value="toxicology">法医毒物鉴定</option>
                        <option value="psychiatric">法医精神病鉴定</option>
                        <option value="evidence">法医物证鉴定</option>
                        <option value="medical">医疗损害鉴定</option>
                    </select>
                </div>
            </div>
            <table class="case-table">
                <thead>
                    <tr>
                        <th>序号</th>
                        <th>编号</th>
                        <th>委托人姓名</th>
                        <th>委托类型</th>
                        <th>创建时间</th>
                        <th>完成时间</th>
                        <th>办案时效(小时)</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>1</td>
                        <td>CASE-2023-001</td>
                        <td>张三</td>
                        <td>法医临床鉴定</td>
                        <td>2023-01-15 09:00</td>
                        <td>2023-01-18 16:30</td>
                        <td>79.5</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>2</td>
                        <td>CASE-2023-002</td>
                        <td>李四</td>
                        <td>法医病理鉴定</td>
                        <td>2023-01-20 14:20</td>
                        <td>2023-01-25 11:45</td>
                        <td>117.4</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>3</td>
                        <td>CASE-2023-003</td>
                        <td>王五</td>
                        <td>医疗损害鉴定</td>
                        <td>2023-02-01 10:15</td>
                        <td>2023-02-08 15:20</td>
                        <td>173.1</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>4</td>
                        <td>CASE-2023-004</td>
                        <td>赵六</td>
                        <td>法医毒物鉴定</td>
                        <td>2023-02-10 13:30</td>
                        <td>2023-02-14 09:15</td>
                        <td>91.8</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>5</td>
                        <td>CASE-2023-005</td>
                        <td>钱七</td>
                        <td>法医精神病鉴定</td>
                        <td>2023-02-15 08:45</td>
                        <td>2023-02-22 17:30</td>
                        <td>176.8</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>6</td>
                        <td>CASE-2023-006</td>
                        <td>孙八</td>
                        <td>法医物证鉴定</td>
                        <td>2023-03-01 16:20</td>
                        <td>2023-03-04 12:40</td>
                        <td>68.3</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>7</td>
                        <td>CASE-2023-007</td>
                        <td>周九</td>
                        <td>法医临床鉴定</td>
                        <td>2023-03-05 11:10</td>
                        <td>2023-03-09 14:25</td>
                        <td>99.3</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>8</td>
                        <td>CASE-2023-008</td>
                        <td>吴十</td>
                        <td>医疗损害鉴定</td>
                        <td>2023-03-12 15:35</td>
                        <td>2023-03-20 10:50</td>
                        <td>187.3</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>9</td>
                        <td>CASE-2023-009</td>
                        <td>郑十一</td>
                        <td>法医病理鉴定</td>
                        <td>2023-03-18 09:25</td>
                        <td>2023-03-23 16:15</td>
                        <td>126.8</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                    <tr>
                        <td>10</td>
                        <td>CASE-2023-010</td>
                        <td>王十二</td>
                        <td>法医毒物鉴定</td>
                        <td>2023-03-25 12:15</td>
                        <td>2023-03-29 08:30</td>
                        <td>92.3</td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <!-- 分页 -->
        <div class="pagination">
            <div class="page-item">«</div>
            <div class="page-item active">1</div>
            <div class="page-item">2</div>
            <div class="page-item">3</div>
            <div class="page-item">4</div>
            <div class="page-item">5</div>
            <div class="page-item">»</div>
        </div>
    </div>

    <script>
        // 案件数据
        const caseData = [
            {
                id: 1, caseNo: 'CASE-2023-001', clientName: '张三', caseType: '法医临床鉴定',
                createTime: '2023-01-15 09:00', completeTime: '2023-01-18 16:30'
            },
            {
                id: 2, caseNo: 'CASE-2023-002', clientName: '李四', caseType: '法医病理鉴定',
                createTime: '2023-01-20 14:20', completeTime: '2023-01-25 11:45'
            },
            {
                id: 3, caseNo: 'CASE-2023-003', clientName: '王五', caseType: '医疗损害鉴定',
                createTime: '2023-02-01 10:15', completeTime: '2023-02-08 15:20'
            },
            {
                id: 4, caseNo: 'CASE-2023-004', clientName: '赵六', caseType: '法医毒物鉴定',
                createTime: '2023-02-10 13:30', completeTime: '2023-02-14 09:15'
            },
            {
                id: 5, caseNo: 'CASE-2023-005', clientName: '钱七', caseType: '法医精神病鉴定',
                createTime: '2023-02-15 08:45', completeTime: '2023-02-22 17:30'
            },
            {
                id: 6, caseNo: 'CASE-2023-006', clientName: '孙八', caseType: '法医物证鉴定',
                createTime: '2023-03-01 16:20', completeTime: '2023-03-04 12:40'
            },
            {
                id: 7, caseNo: 'CASE-2023-007', clientName: '周九', caseType: '法医临床鉴定',
                createTime: '2023-03-05 11:10', completeTime: '2023-03-09 14:25'
            },
            {
                id: 8, caseNo: 'CASE-2023-008', clientName: '吴十', caseType: '医疗损害鉴定',
                createTime: '2023-03-12 15:35', completeTime: '2023-03-20 10:50'
            },
            {
                id: 9, caseNo: 'CASE-2023-009', clientName: '郑十一', caseType: '法医病理鉴定',
                createTime: '2023-03-18 09:25', completeTime: '2023-03-23 16:15'
            },
            {
                id: 10, caseNo: 'CASE-2023-010', clientName: '王十二', caseType: '法医毒物鉴定',
                createTime: '2023-03-25 12:15', completeTime: '2023-03-29 08:30'
            }
        ];

        // 计算办案时效(小时)
        function calculateEfficiency(createTime, completeTime) {
            const create = new Date(createTime);
            const complete = new Date(completeTime);
            const diffMs = complete - create;
            return (diffMs / (1000 * 60 * 60)).toFixed(1);
        }

        // 获取时效等级类名
        function getEfficiencyClass(hours) {
            if (hours <= 72) return 'efficiency-good';      // 3天内 - 绿色
            if (hours <= 120) return 'efficiency-normal';   // 5天内 - 橙色
            return 'efficiency-slow';                        // 超过5天 - 红色
        }

        // 渲染表格
        function renderTable() {
            const tbody = document.querySelector('.case-table tbody');
            tbody.innerHTML = '';
            
            caseData.forEach((item, index) => {
                const efficiency = calculateEfficiency(item.createTime, item.completeTime);
                const efficiencyClass = getEfficiencyClass(efficiency);
                
                tbody.innerHTML += `
                    <tr>
                        <td>${index + 1}</td>
                        <td>${item.caseNo}</td>
                        <td>${item.clientName}</td>
                        <td>${item.caseType}</td>
                        <td>${item.createTime}</td>
                        <td>${item.completeTime}</td>
                        <td><span class="${efficiencyClass}">${efficiency}</span></td>
                        <td>
                            <button class="btn btn-primary">详情</button>
                            <button class="btn btn-success">下载/打印鉴定报告</button>
                        </td>
                    </tr>
                `;
            });
        }

        // 分页切换
        const pageItems = document.querySelectorAll('.page-item');
        pageItems.forEach(item => {
            item.addEventListener('click', function() {
                if (!this.textContent.includes('«') && !this.textContent.includes('»')) {
                    pageItems.forEach(pi => pi.classList.remove('active'));
                    this.classList.add('active');
                }
            });
        });

        // 初始化页面
        document.addEventListener('DOMContentLoaded', function() {
            renderTable();
        });
    </script>
</body>
</html>